home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / amiga / asrc29k.lha / udp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  2.4 KB  |  72 lines

  1. #ifndef    NUDP
  2.  
  3. #include "global.h"
  4. #include "netuser.h"
  5. #include "internet.h"
  6.  
  7. /* SNMP MIB variables, used for statistics and control. See RFC 1066 */
  8. extern struct mib_entry Udp_mib[];
  9. #define    udpInDatagrams    Udp_mib[1].value.integer
  10. #define    udpNoPorts    Udp_mib[2].value.integer
  11. #define    udpInErrors    Udp_mib[3].value.integer
  12. #define    udpOutDatagrams    Udp_mib[4].value.integer
  13. #define    NUMUDPMIB    4
  14.  
  15. /* User Datagram Protocol definitions */
  16. #define    NUDP    20
  17.  
  18. /* Structure of a UDP protocol header */
  19. struct udp {
  20.     int16 source;    /* Source port */
  21.     int16 dest;    /* Destination port */
  22.     int16 length;    /* Length of header and data */
  23.     int16 checksum;    /* Checksum over pseudo-header, header and data */
  24. };
  25. #define    UDPHDR    8    /* Length of UDP header */
  26.  
  27. /* User Datagram Protocol control block
  28.  * Each entry on the receive queue consists of the
  29.  * remote socket structure, followed by any data
  30.  */
  31. struct udp_cb {
  32.     struct udp_cb *prev;    /* Linked list pointers */
  33.     struct udp_cb *next;
  34.     struct socket socket;    /* Local port accepting datagrams */
  35.     void (*r_upcall) __ARGS((struct iface *iface,struct udp_cb *,int));
  36.                 /* Function to call when one arrives */
  37.     struct mbuf *rcvq;    /* Queue of pending datagrams */
  38.     int rcvcnt;        /* Count of pending datagrams */
  39.     int user;        /* User link */
  40. };
  41. extern struct udp_cb *Udps[];    /* Hash table for UDP structures */
  42. #define    NULLUDP    (struct udp_cb *)0
  43.  
  44. /* UDP primitives */
  45.  
  46. /* In udp.c: */
  47. int del_udp __ARGS((struct udp_cb *up));
  48. struct udp_cb *open_udp __ARGS((struct socket *lsocket,
  49.     void (*r_upcall) __ARGS((struct iface *iface,struct udp_cb *,int))));
  50. int recv_udp __ARGS((struct udp_cb *up,struct socket *fsocket,struct mbuf **bp));
  51. int send_udp __ARGS((struct socket *lsocket,struct socket *fsocket,char tos,
  52.     char ttl,struct mbuf *data,int16 length,int16 id,char df));
  53. void udp_input __ARGS((struct iface *iface,struct mbuf *bp,struct ip *ip,
  54.     int rxbroadcast));
  55.  
  56. #ifdef HOPCHECK
  57. void udp_icmp __ARGS((int32 icsource, int32 ipsource,int32 ipdest,
  58.     char ictype,char iccode,struct mbuf **bpp));
  59. /* In hop.c: */
  60. void hop_icmp __ARGS((struct udp_cb *ucb, int32 icsource, int32 ipdest,
  61.     int16 udpdest, char ictype, char iccode));
  62. #endif
  63. /* In udpcmd.c: */
  64. int st_udp __ARGS((struct udp_cb *udp,int n));
  65.  
  66. /* In udphdr.c: */
  67. struct mbuf *htonudp __ARGS((struct udp *udp,struct mbuf *data,struct pseudo_header *ph));
  68. int ntohudp __ARGS((struct udp *udp,struct mbuf **bpp));
  69.  
  70. #endif    /* NUDP */
  71.  
  72.